Skip to content

Remove declare to clean up global scope #354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

drake-nathan
Copy link

Description

As described in the issue I filed, this declare statement is polluting the global scope. It's providing autocomplete in prettier.config.js files, but offers no real type safety. For instance, if you install the plugin but never add it to your plugins, the tailwind options will appear and cause a config error.

Importing the types like this is far safer.

/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */

You might consider this a breaking change, but I don't think a major is necessary. Since there's no actual type-checking in .js files, this shouldn't cause any errors. You'd just lose out on intellisense until you imported the type above. Users with a .json config won't notice anything at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant